#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(int argc, const char *argv[])
{
	srand(time(NULL));

	int rand_num = rand() % 100 + 1;
	int input_num = 0;
	int range_max = 100;
	int range_min = 0;
	int count = 0;
	printf("请输入第%d次猜测的结果, 范围[%d, %d]:", ++count, range_min, range_max);
	scanf("%d", &input_num);
	while(input_num != rand_num){
		if(input_num > rand_num){
			printf("猜大了\n");
			range_max = input_num - 1;
		}else{
			printf("猜小了\n");
			range_min = input_num + 1;
		}
		printf("请输入第%d次猜测的结果, 范围[%d, %d]:", ++count, range_min, range_max);
		scanf("%d", &input_num);
	}
	printf("恭喜你,猜对了!!!\n");

	return 0;
}
